#include <stdio.h>
#include <stdlib.h>

typedef unsigned char *byte_pointer;
void show_bytes(unsigned char *, size_t);
void show_char(char);
void show_unsigned_int(unsigned int);

int main()
{
    char *sp = (char*)malloc(sizeof(char));
    *sp = 0xFF;
    unsigned int *dp = (unsigned int*)malloc(sizeof(unsigned int));
    *dp = (unsigned int)*sp;

    printf("*sp = ");
    show_char(*sp);
    printf("*dp = ");
    show_unsigned_int(*dp);

    return 0;
}

void show_bytes(byte_pointer start, size_t len)
{
    size_t i;
    for (i = 0; i < len; i++)
        printf("%.2x", start[i]);
    printf("\n");
}

void show_char(char x) {
    show_bytes((byte_pointer) &x, sizeof(char));
}

void show_unsigned_int(unsigned int x) {
    show_bytes((byte_pointer) &x, sizeof(unsigned int));
}